<?php if (!defined('BASEPATH')) exit('Sorry, error.. :]');

class CategoryLib {
    var $CI;
    function __construct()
    {
        $this->CI =& get_instance();
    }
    function level($id) 
    {
        if ($id != 0) {
            $cat = Doctrine::getTable('Category_Photo')->findOneById($id);
            return ++$cat->level;
        }else{
            return 0;
        }
    }
    function order($id) {        $cat = Doctrine::getTable('Category_Photo')->findByParent_id($id)->getLast();
        if (isset($cat->order)) {
            return ++$cat->order;
        }else{
            return 0;
        }
    }
}